home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / coreaids.zip / PARM_GET.ASM < prev    next >
Assembly Source File  |  1987-06-25  |  1KB  |  49 lines

  1. ;    DESC:    Gets parameters passed to program from DOS level     V1.00
  2. ;        at DS+80H
  3. ;    IN:    *{DS} value passed to data segment at start of main program
  4. ;    OUT:    *{SEG_VAL} segment and
  5. ;        *{OFFSET} offset of parameter string
  6. ;        *{LENGTH} length of parameter string
  7. ;    SAMPLE:    Callm    PARM_GET,<DS>,<SEG_VAL,OFFSET,LENGTH>
  8. ;    ###################################################################
  9.  
  10.     Extrn    PUSHALL:Near
  11.     Extrn    POPALL:Near
  12.  
  13. PARM_GEC    Segment
  14.     Assume    CS:PARM_GEC
  15.     Public    PARM_GET
  16.  
  17.                         ;notice.
  18.     DB    'PARM_GET - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  19.  
  20. PARM_GET    Proc    Near
  21.  
  22.     Call    PUSHALL                ;save registers.
  23.  
  24.     Pop    DS                ;recover data segment.
  25.  
  26.     Mov    BP,81H                ;offset to parameter.
  27.  
  28.     Xor    AH,AH                ;clear top of AX.
  29.  
  30.     Mov    AL,DS:BYTE PTR[80H]        ;get length of parameter block
  31.     Add    BP,AX                ;and find offset to end.
  32.  
  33.     Push    AX                ;return length of parameter.
  34.  
  35.     Mov    AX,82H                ;return offset of block.
  36.     Push    AX
  37.  
  38.     Push    DS                ;return segment of block.
  39.  
  40.     Mov    AX,0                ;place 0 byte at end of block.
  41.     Mov    DS:[BP],AX
  42.  
  43.     Call    POPALL                ;recover registers.
  44.     Ret
  45.  
  46. PARM_GET    Endp
  47. PARM_GEC    Ends
  48.     End
  49.